<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./lib/vue.js"></script>
    <style>
      .box {
        width: 100%;
        height: 100px;
        background-color: red;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <div @click="divClick" class="box">
        <button @click.stop="btnClick">按钮</button>
      </div>

      <a href="http://www.baidu.com" @click.prevent="testClick">百度</a></a>
      <a href="http://www.baidu.com" @click="testClick2">百度</a></a>


      <hr>
      <!-- 按键修饰符 -->
      <input type="text" v-on:keyup.enter.ctrl="sendClick">
    </div>
    <script>
      var vum = new Vue({
        el: "#app",
        data() {
          return {};
        },
        methods: {
          divClick() {
            console.log("点击了div");
          },
          btnClick() {
            console.log("点击了btn");
          },
          testClick(){
            console.log(222);
          },
          testClick2(evt){
            // if(1){
            //     evt.preventDefault();
            // }
          },
          sendClick(){
            console.log('输入 中 按回车');
          }
        },
      });
    </script>
  </body>
</html>
